"""
富二代

"""
# 单继承
# 爷爷类
# class Grandfather(object):
#     def __init__(self):
#         print('Grandfather')
#
#     def sleep(self):
#         print("sleep")
#
#
# # 父亲类
# class Father(Grandfather):
#     def eat(self):
#         print("eat")
#
#     def drink(self):
#         print("drink")
#
#
# # 儿子类
# class Son(Father):
#     def study_python(self):
#         print("python")
#
#
# s = Son()
# s.study_python()
# s.eat()
# s.sleep()


"""情景1"""
# class Father1:
#     def run(self):
#         print("father1 run")
#
#
# class Father2:
#     def run(self):
#         print("father2 run")
#
#
# class Son(Father1, Father2):  # 拥有相同方法时，左边优先执行
#     pass


# s = Son()
# s.run()


# """情景2"""
# class Grandfather:
#     def sleep(self):
#         print("Grandfather sleep")
#
#
# class Father1(Grandfather):
#     def run(self):
#         print("father1 run")
#
#
# class Father2:
#     def sleep(self):
#         print(" Father2 sleep")
#
#
# class Son(Father1, Father2):  # 必须要左边的执行完了,才会执行右边的父类
#     pass
#
#
# s = Son()
# s.sleep()

class Grandfather1:
    def sleep(self):
        print("sleep 12")


class Father1(Grandfather1):
    def run(self):
        print("father1 run")


class Father2(Grandfather1):
    def sleep(self):
        print("sleep 6")


class Son(Father1, Father2):  # 如果同根的话，根是最后才执行的
    def sleep(self):
        print("sleep 1111111")


s = Son()
s.sleep()
print(Son.__mro__)  # 通过mro方法可以程序执行或者继承顺序的情况

